-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
34 arc f5 save slack channels #59
base: develop
Are you sure you want to change the base?
34 arc f5 save slack channels #59
Conversation
…tabase by a schedule
"id", | ||
"name" | ||
}) | ||
@Getter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @DaTa instead of many Annotations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@Service | ||
public class SlackApiServiceImpl implements SlackApiService { | ||
|
||
SlackApi slackApi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@Setter | ||
@NoArgsConstructor | ||
@ToString | ||
@EqualsAndHashCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need @entity annotation
@@ -1,4 +1,4 @@ | |||
package juja.microservices.slack.archive.model; | |||
package juja.microservices.slack.archive.model.entity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need @entity annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i read spring docs. MongoTemplate doesn't require @entity annotation
9.5. Saving, Updating, and Removing Documents
https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo-template
and there are two ways with Id annotation.
- A property or field annotated with @id (org.springframework.data.annotation.Id) will be mapped to the _id field.
- A property or field without an annotation but named id will be mapped to the _id field.
I think it is a good case to use @id annotation explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Nikolay
|
||
public class Util { | ||
|
||
public static String getFile(String fileName){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "readStringFromFile" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
@SpringBootApplication | ||
@EnableScheduling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, move @EnableScheduling to SchedulerConfig class
It will be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1,4 +1,4 @@ | |||
package juja.microservices.slack.archive.model; | |||
package juja.microservices.slack.archive.model.entity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Nikolay
import juja.microservices.slack.archive.model.Channel; | ||
import juja.microservices.slack.archive.model.Message; | ||
import juja.microservices.slack.archive.model.entity.Channel; | ||
import juja.microservices.slack.archive.model.entity.Message; | ||
|
||
import java.util.List; | ||
|
||
public interface ArchiveRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better extract logic for messages to another repository
and rename this repo to slackchannelrepository ?
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you suggest it too) ok I will do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
|
||
@Repository | ||
@Slf4j | ||
public class SlackApiImpl implements SlackApi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is better naming for interface SlackApiClient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
@Override | ||
public List<ChannelDTO> receiveChannelsList() { | ||
String urlTemplate = slackApiChannelsUrlTemplate + slackApiToken; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old service use simpleslackapi,
Why do you use resttemplate instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will sort out with simpleSlackApi
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
import lombok.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No * import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import juja.microservices.slack.archive.model.MessagesRequest; | ||
import juja.microservices.slack.archive.model.dto.ChannelDTO; | ||
import juja.microservices.slack.archive.model.dto.MessagesRequest; | ||
import juja.microservices.slack.archive.model.entity.Message; | ||
|
||
import java.util.List; | ||
|
||
public interface ArchiveService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is better naming ChannelService and extract some messages logic to another service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is a good idea and in this case I will do separate repositories for channel and messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
|
||
String result = ""; | ||
|
||
Foo foo = new Foo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the strange logic for reading the file
For example, you can use in test
IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the method is static, I can't use non static method this.getClass() here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to return this code into test or another case classz should be ones from parameters this method
After that this method becomes simple
@NikolayNN please update your branch from upstream and fix conflicts |
…lack-channels # Conflicts: # slack-archive/src/main/java/juja/microservices/slack/archive/SlackArchiveApplication.java
…o ChannelService, MessageService and ChannelRepository, MessageRepository
connect #34